molecule_lpeg.tex
Description: Binary data
Am 23.02.2009 um 18:14 schrieb Mojca Miklavec:
thanks a lot for the very nice code :) :) :)
The second example (H_2^+) does not return expected result - it
should have been
H\lohi{2}{+}
instead, but I don't require such cases for the current
[small]#1}}\fi }
\def\finishchem%
{\ifvoid\chemlowbox \else
\iffluor \fluorfalse \kern-.1em \fi\low{\box\chemlowbox}\fi}
% for kerning after F
\newif\iffluor
\unexpanded\def\molecule%
{\bgroup
\catcode`\_=\active \uccode`\~=`\_ \uppercase{\let~\chemlow}%
\catcode`\^=\active \uccode
)
end
\stopluacode
\def\molecule#1{\ctxlua{thirddata.molecule('#1')}}
\starttext
\molecule{H_2SO_4}
\molecule{H_2^+}
\stoptext
Wolfgang
___
If your question is of interest to others as well, please add an entry
(text)
text = string.gsub(text,_,\\low)
text = string.gsub(text,%^,\\high)
tex.sprint(text)
end
\stopluacode
\def\molecule#1{\ctxlua{thirddata.molecule('#1')}}
hmm
Isn't better to remember original \molecule ?
I mean, something like
\let\ORIGINALmolecule\molecule
\def\molecule#1